\begin{problem}{Mirror Placement}{mirror.in}{mirror.out}{2 seconds}{}{}

You will be given the map of a maze, with exactly two openings on 
the boundary. Your task is to add mirrors to the 
maze in such an arrangement that if a laser is 
shined through one opening in the boundary, it will 
exit through the other opening. Your program should 
return the least number of mirrors necessary to be added in 
order to accomplish this. If no solution is possible, return $-1$. 

The maze will consist of 
walls (`\texttt{\#'}), open 
spaces (`\texttt{.}'), and 
mirrors (`\texttt{/}' and 
`\texttt{`}') arranged on a regular grid. 
The laser may only travel though open spaces and 
reflect off of mirrors. If it hits a wall, 
the light will be absorbed. You may only place mirrors on open spaces. 

Mirrors are always at a 45-degree angle to 
the axes of the maze, and deflect the laser at a right angle. 

For example, given the following maze: 

\begin{verbatim}
#######
##....#
##.##.#
##.##.#
......#
##.####
##.####
\end{verbatim}

There are three arrangements of mirrors that will deflect the 
laser from one opening in the boundary to the other: 

\begin{center}
\includegraphics[width=6.6cm]{pics/mirror.eps}
\end{center}
 
These three solutions require 1, 3, and 4 mirrors, 
respectively. The least number of mirrors needed is 1, so 1 
is the correct answer. 

The map may have mirrors already placed, which you may 
use but cannot move. For example, given the following map: 

\begin{verbatim}
#######
##....#
##.##.#
##.##.#
../...#
##.####
##.####
\end{verbatim}

there is only one solution (the third arrangement in the figure above). 
Three more mirrors must be added, so the correct answer in this case is 3. 
 
Since `$\mathtt{\backslash}$' is a special character, we will use 
the `\texttt{/}' (forward slash) and 
`\texttt{`}' (back quote) characters to indicate mirrors in the input. 

\InputFile

The first line of the input contain the number of rows $m$ and the
number of columns $n$, which are in range between 3 and 50, inclusive.
$m$ lines of $n$ characters follow, each of them is one of 
the following: `\texttt{\#}', `\texttt{.}', `\texttt{/}', and `\texttt{`}'. 
Exactly 2 characters on the 
boundary of map will be `\texttt{.}'. All other characters 
on the boundary will be `\texttt{\#}'. The characters in the four corners of map 
will be `\texttt{\#}'. 

\OutputFile

Output the least number of mirrors or $-1$ if no solution is possible. 

\Example

\begin{example}
\exmp{
7 7
\#\#\#\#\#\#\#
\#\#....\#
\#\#.\#\#.\#
\#\#.\#\#.\#
......\#
\#\#.\#\#\#\#
\#\#.\#\#\#\#
}{
1
}%
\exmp{
5 8
\#\#\#\#\#\#\#\#
\#\#....\#\#
\#\#.\#\#.\#\#
\#\#...`..
\#\#\#\#\#.\#\#
}{
3
}%
\exmp{
7 11
\#\#\#\#\#\#\#\#\#\#\#
...../.....
\#\#\#\#\#.\#\#\#\#\#
\#\#\#.....\#\#\#
\#\#\#.\#\#\#.\#\#\#
\#\#\#.....\#\#\#
\#\#\#\#\#\#\#\#\#\#\#
}{
-1
}%
\exmp{
6 11
\#\#\#\#\#\#\#\#.\#\#
\#./......`\#
\#../.`....\#
\#.`...../.\#
\#....`.../\#
\#\#\#.\#\#\#\#\#\#\#
}{
0
}%
\exmp{ 
6 7
\#.\#\#\#\#\#
\#..\#\#\#\#
\#\#..\#\#\#
\#\#\#..\#\#
\#\#\#\#..\#
\#\#\#\#\#.\#
}{
8
}%
\exmp{
3 4
\#\#\#\#
\#\#\#\#
\#..\#
}{
2
}% 
\end{example}

\end{problem}